package cn.itcast.bos.mq;

import cn.itcast.bos.utils.MsgUtils;

import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;
//消费者
public class SmsListener implements MessageListener {
    @Override
    public void onMessage(Message message) {
        System.out.println("actimeMQ发送短信");
        MapMessage  mapMessage= (MapMessage)message;
        try {
            String telephone = mapMessage.getString("telephone");
            String randomCode = mapMessage.getString("randomCode");
            MsgUtils.sendMsg(telephone,randomCode);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
